package com.huoniu.gateway.filter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * @类 名： AuthGatewayFilter <br/>
 * @描 述： <br/>
 * @日 期： 2020/9/18 10:32<br/>
 * @作 者： 侯建军<br/>
 * @版 本： 1.0.0
 * @since JDK 1.8
 */
@Slf4j
@Component
public class AuthGatewayFilter implements GlobalFilter {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        log.info("网关过滤器");
        ServerHttpRequest serverHttpRequest = exchange.getRequest();
        log.info("{}", serverHttpRequest.getPath());

        return chain.filter(exchange);
    }
}
